﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Skyhook.Isometry
{
    internal class MapCreator<T> where T : new()
    {
        int Width = 0;
        int Height = 0;

        public MapCreator(int width, int height)
        {
            if (width <= 0 || height <= 0)
            {
                throw new Exception("Incorrect map size (" + width.ToString() + " x " + height.ToString() + ")");
            }

            Width = width;
            Height = height;
        }

        public T[][] Create()
        {
            T[][] map = new T[Width][];

            for (int j = 0; j < Width; j++)
            {
                map[j] = new T[Height];
            }

            for (int i = 0; i < Height; i++)
            {
                for (int j = 0; j < Width; j++)
                {
                    map[j][i] = new T();
                }
            }

            return map;
        }
    }
}
